<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><#if query !=''>Download Youtube ${query}<#else>ShareYouTubeVideo - Video Search</#if></title>
<#if query != ''>
<meta name="description" content="Download YouTube Video of ${query} for Free, Convert ${query}" YouTube to MP3 />
</#if>
<link href="${cssRoot}/global.css" rel="stylesheet" type="text/css" />
<link href="${cssRoot}/ui/jquery-ui-1.8.17.custom.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="${cssRoot}/jquery.fancybox-1.3.4.css" media="screen" />
</head>

<body>
	<input type="hidden" id="contextPath" value="${request.contextPath}" />
	<#include "/i18n/" + locale + "/head.ftl">
	<div id="main2">
	<div class="seachform">
    	<div class="sch_l"></div>
    	<div class="sch_box">
      		<div class="relation">${i18n("txtUrl_prompt")}</div>
      		<div class="input-keyword">
        		<div class="inputbox"><input id="txtUrl" class="search-keyword" type="text" onkeyup="inputOnkeyup(event);" /></div>
        		<div class="sch-btn">
         			<a href="javascript:;" onclick="parseVideos();">Get Video</a>
        		</div>
        		<div class="clear"></div>
      		</div>
    	</div>
    	<div class="sch_r"></div>
    	<div class="clear"></div>
  	</div>
	<#if videos??>
		<#assign pageSize = videos.pagenate.pagenateInfo.pageSize>	
		<#assign start = videos.pagenate.pagenateInfo.start>
		<#assign items = videos.items>
		<#assign size = items?size>
		<#include "/macro/utils.ftl">	
	<!----result info-->
  	<div id="resultTitle" class="s_rusult">
    	<div class="s_words">Search results for <span id="queryWord" class="font2">"${query}"</span></div>
    	<div id="resultCount" class="s_count"></div>
    	<div class="clear"></div>
  	</div>
  	<!--search result-->
	<div id="result" class="result">
		<#if size &gt; 0>
			<#assign preUrl = request.contextPath>
			<#list items as item>
				<#assign downloadUrl = preUrl + item.id>
				<div class="s_mp3">
					<a href="http://www.youtube.com/v/${item.videoId}?fs=1&autoplay=1">
						<div class="s_mp3img">
							<img src="${item.thumbnail}" width="117" height="90" alt="${item.title}" />
						</div>
					</a>
					<div class="mp3_describe"><p><a href="http://www.youtube.com/v/${item.videoId}?fs=1&autoplay=1">${item.title}</a></p> 
						<div class="describe">${item.description}</div>
						<div class="facets"> by ${item.uploader}<span>&nbsp;|&nbsp;</span><@formatSeconds seconds=item.duration /><span>&nbsp;|&nbsp;</span>
								${item.viewCount} views
						</div>
					</div>
					<div class="convert">
						<a class="video" href="http://www.youtube.com/v/${item.videoId}?fs=1&autoplay=1">Play</a>
						<a class="convert-to-mp3" href="${preUrl}/download/${item.videoId}">Get Video</a>
					</div>
					<div class="clear"></div>
				</div>
			</#list>
		</#if>
	</div>
	<#else>
		<div>Sorry,no result!</div>
	</#if>
	<div id="pageFooter" class="pages">
		<#if query != ''>
		<div id="pageFooter">			
			<#assign totalCount = videos.pagenate.totalCount>
			<#assign preUrl = request.contextPath + "/search/" + query>
			<#include "/macro/pager.ftl">			
			<@pager total=totalCount url=preUrl page=page len=pageSize/>			
		</div>
	</#if>
  	</div>
  	<#include "/include/footer.ftl">
	<script type="text/javascript" src="${jsRoot}/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="${jsRoot}/utils.js"></script>
	<script type="text/javascript" src="${jsRoot}/js.js"></script>
	<script type="text/javascript" src="${jsRoot}/jquery.fancybox-1.3.4.pack.js"></script>
	<script type="text/javascript" src="${jsRoot}/search.js"></script>
	<script type="text/javascript" src="${jsRoot}/ui/jquery-ui-1.8.17.custom.min.js"></script>
	<script type="text/javascript" src="${jsRoot}/prompt.js"></script>
	
	<script type="text/javascript">
		$(function(){
			initPrompt();

			$("div.s_mp3 > a,div.s_mp3 div.mp3_describe > p > a,div.s_mp3 div.convert a.video").click(function() {
				$.fancybox({
					'padding'		: 10,
					'autoScale'		: false,
					'transitionIn'	: 'none',
					'transitionOut'	: 'none',
					'title'			: this.title,
					'width'			: 640,
					'height'		: 385,
					'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
					'type'			: 'swf',
					'swf'			: {
						'wmode'				: 'transparent',
						'allowfullscreen'	: 'true'
					}
				});
		
				return false;
			});
		});
	</script>
</div>
</body>
</html>